package com.liu.project;

import com.liu.project.kmeans.ClusterModel;
import com.liu.project.kmeans.kmeans;
import com.liu.project.service.CertificateService;
import com.liu.project.utils.RedisUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@SpringBootApplication
@MapperScan("com.liu.project.dao")
public class ProjectApplication  implements ApplicationRunner {

    @Autowired
    RedisUtil redisUtil;
    @Autowired
    CertificateService certificateService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        kmeans kmeans = new kmeans(redisUtil,certificateService);
        ClusterModel train = kmeans.train(120);
        kmeans.redis(train);
        train.centers();
        train.outputAllResult();
        System.out.println("run==============>");
    }


    public static void main(String[] args) {
        SpringApplication.run(ProjectApplication.class, args);
        System.out.println("开启");
    }

}
